﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using br.com.SistemaChamados.Model;
using br.com.SistemaChamados.Enum;
using br.com.SistemaChamados.DAO;

namespace br.com.SistemaChamados.Controller
{
    public class CallSubCategoryController
    {
        public EnumGenericState InsertCallSubCategory(CallSubCategory callSubCategory)
        {
            EnumGenericState stateTransaction = EnumGenericState.GENERIC_STATE_UNKNOW;
            try
            {
                stateTransaction = CallSubCategoryDAO.InsertCallSubCategory(callSubCategory);
            }
            catch (Exception ex)
            {
                stateTransaction = EnumGenericState.GENERIC_STATE_FAILED;
                throw ex;
            }
            return stateTransaction;
        }

        public EnumGenericState UpdateCallSubCategory(CallSubCategory callSubCategory)
        {
            EnumGenericState stateTransaction = EnumGenericState.GENERIC_STATE_UNKNOW;
            try
            {
                stateTransaction = CallSubCategoryDAO.UpdateCallSubCategory(callSubCategory);
            }
            catch (Exception ex)
            {
                stateTransaction = EnumGenericState.GENERIC_STATE_FAILED;
                throw ex;
            }
            return stateTransaction;
        }

        public EnumGenericState DeleteCallSubCategory(CallSubCategory callSubCategory)
        {
            EnumGenericState stateTransaction = EnumGenericState.GENERIC_STATE_UNKNOW;
            try
            {
                stateTransaction = CallSubCategoryDAO.DeleteCallSubCategory(callSubCategory);
            }
            catch (Exception ex)
            {
                stateTransaction = EnumGenericState.GENERIC_STATE_FAILED;
                throw ex;
            }
            return stateTransaction;
        }

        public List<CallSubCategory> GetCallSubCategoriesByCallCategory(CallSubCategory callSubCategory)
        {
            List<CallSubCategory> listCallSubCategory = new List<CallSubCategory>();
            try
            {
                listCallSubCategory = CallSubCategoryDAO.getCallSubCategoriesByCallCategory(callSubCategory);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return listCallSubCategory;
        }

        public CallSubCategory GetCallSubCategory(CallSubCategory callSubCategory)
        {
            CallSubCategory newCallSubCategory = new CallSubCategory();
            try
            {
                newCallSubCategory = CallSubCategoryDAO.getCallSubCategory(callSubCategory);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return newCallSubCategory;
        }

        public List<CallSubCategory> GetCallSubCategories()
        {
            List<CallSubCategory> listCallCategories = new List<CallSubCategory>();

            try
            {
                listCallCategories = CallSubCategoryDAO.getCallSubCategories();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return listCallCategories;
        }
        public CallSubCategoryController()
        {
            //
            // TODO: Add constructor logic here
            //
        }
    }
}